package com.example.unruly_zhao.mopaide.base;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.unruly_zhao.mopaide.R;
import com.example.unruly_zhao.mopaide.bean.Hotspot_Bean;

import java.util.List;

/**
 * Created by Unruly_Zhao on 2017/8/22.
 */

public class Hotpost_Adapter extends RecyclerView.Adapter<Hotpost_Adapter.Hotpost_Adapter_vh>{

    private Context mContext;

    private List<Hotspot_Bean.ResultBean.DataBean> hoepost_bean;

    public Hotpost_Adapter(Context context, List<Hotspot_Bean.ResultBean.DataBean> hoepost_bean) {

        mContext = context;
        this.hoepost_bean = hoepost_bean;

    }


    @Override
    public Hotpost_Adapter_vh onCreateViewHolder(ViewGroup parent, int viewType) {

        View itemView =  LayoutInflater.from(mContext).inflate(R.layout.hotpost_item,parent,false);

        return new Hotpost_Adapter_vh(itemView);
    }

    @Override
    public void onBindViewHolder(Hotpost_Adapter_vh holder, int position) {

        holder.mTextView.setText(hoepost_bean.get(position).getTitle());


    }

    @Override
    public int getItemCount() {

        return hoepost_bean==null?0:hoepost_bean.size();

    }

    class Hotpost_Adapter_vh extends RecyclerView.ViewHolder{

        public TextView mTextView;


        public Hotpost_Adapter_vh(View itemView) {

            super(itemView);

            mTextView= (TextView) itemView.findViewById(R.id.tv_hotpost_text);





        }
    }
}
